path:
    data: "{{ elk_data_root_path }}/{{ elk_role }}"
    logs: "{{ elk_logs_root_path }}/{{ elk_role }}"
#    repo: "{{ es_snapshot_root_path }}"

cluster.name: "{{ es_cluster_name }}"

node:
    name: "{{ inventory_hostname }}"
    roles: {{ es_node_roles | selectattr('group', 'in', group_names) | map(attribute='roles') | flatten }}

network.host:
    - "{{ ansible_host }}"
    - "_local_"

bootstrap.memory_lock: {{ es_memory_lock }}

discovery.seed_hosts:
{% for master in groups['es_master'] %}
    - {{ hostvars[master]['ansible_host'] }}
{% endfor %}

{% if es_cluster_bootstrapping %}
# https://www.elastic.co/guide/en/elasticsearch/reference/current/important-settings.html#initial_master_nodes
# After the cluster forms successfully for the first time,
# remove the cluster.initial_master_nodes setting from each node’s configuration and never set it again for this cluster.
# Do not configure this setting on nodes joining an existing cluster.
# Do not configure this setting on nodes which are restarting.
# Do not configure this setting when performing a full-cluster restart.
cluster.initial_master_nodes:
{% for master in groups['es_master'] %}
    - {{ hostvars[master]['ansible_host'] }}
{% endfor %}
{% endif %}

xpack.security.audit.enabled: false

{% if elk_tls_enabled %}
xpack.security.enabled: true
xpack.security.transport.ssl:
    enabled: true
    verification_mode: certificate
    client_authentication: required
    keystore.path: /etc/elasticsearch/tls/elastic-certificates.p12
    truststore.path: /etc/elasticsearch/tls/elastic-certificates.p12

xpack.security.http.ssl:
    enabled: true
    key: /etc/elasticsearch/tls/{{ es_cluster_name }}-certificate.key
    certificate: /etc/elasticsearch/tls/{{ es_cluster_name }}-certificate.pem
    verification_mode: none
{% endif %}

ingest.geoip.downloader.enabled: false
